package by.bsu.touragency.db.beans;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class TransportType {
	private int id;
	private String name;
	private String number;

	public TransportType() {
		super();
	}

	public TransportType(String name, String number) {
		super();
		this.name = name;
		this.number = number;

	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public boolean setName(String name) {
		if (isValidTypeName(name)) {
			this.name = name;
			return true;
		}
		return false;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public boolean isValidTypeName(String name) {
		if (name != "" & name != null && name.length() < 100) {
			Pattern p = Pattern.compile("(([A-Z])*([a-z])+)+");
			Matcher m = p.matcher(name);
			return m.matches();
		} else
			return false;
	}
}
